package com.wanmait.houlang.manageController;


import com.wanmait.houlang.pojo.DTO;
import com.wanmait.houlang.pojo.Professional;
import com.wanmait.houlang.service.ProfessionalService;
import com.wanmait.houlang.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/manage")
public class ManageProfessionalController {

    @Autowired
    private ProfessionalService professionalService;

    //获取所有的本科专业
    @GetMapping("bachelorPro")
    public Result searchBachelorPro(){
        List<Professional> bachelorPro = professionalService.findBachelorPro();
        return Result.success(bachelorPro);
    }
    //获取所有的专科专业
    @GetMapping("juniorPro")
    public Result searchJuniorPro(){
        List<Professional> juniorPro=professionalService.findJuniorPro();
        return Result.success(juniorPro);
    }
    //增加专业
    @GetMapping("insertMajor")
    public void insertMajor(DTO dto){
        professionalService.insert(dto);
    }
}
